using System.Collections.Generic;
using RimWorld;
using Verse;
using UnityEngine;
using System.Linq;

namespace RI_Talisman
{
    public static class Worker_ImFormationArea
    {
        public static void AddImFormationEffect(Map map)
        {
            IEnumerable<Pawn> pawns = map.mapPawns.AllPawns;
            List<ImFormationArea> formAreas = ImPowerFoundationUtility.GetFormZones(map);
            foreach (ImFormationArea formArea in formAreas)
            {
                Color color = Color.blue;
                GenDraw.DrawFieldEdges(formArea.MyRect.ToList(), color);
                GenSpawn.Spawn(ThingDefOf.Plasteel, formArea.CenterCell, map);

            }
            foreach (Pawn pawn in pawns)
            {
                if (!pawn.IsFreeColonist)
                {
                    pawn.health.AddHediff(HediffDefOf.PsychicShock);
                }
            }
        }
    }
}